//
//  UITextView+YZPlaceholder.m
//  VET
//
//  Created by 刘文靖 on 2018/7/2.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "UITextView+YZPlaceholder.h"

@implementation UITextView (YZPlaceholder)
/**
 设置textView placeholder
 
 @param text 文字
 @param textColor 颜色
 @param font 字体
 */
- (void)addPlaceholderWithText:(NSString *)text
                     textColor:(UIColor *)textColor
                          font:(UIFont *)font {
    UILabel *placeHolderLabel = [[UILabel alloc] init];
    placeHolderLabel.text = text;
    placeHolderLabel.numberOfLines = 0;
    placeHolderLabel.textColor = textColor;
    [placeHolderLabel sizeToFit];
    [self addSubview:placeHolderLabel];
    // same font
    placeHolderLabel.font = font;
    
    [self setValue:placeHolderLabel forKey:@"_placeholderLabel"];
}
@end
